
import Vue from "vue";
import VueRouter from "vue-router";

// 引入路由组件
import Home from '@/views/Home'
import Login from '@/views/Login'
import Register from '@/views/Register'
import Search from '@/views/Search'


Vue.use(VueRouter)
export default new VueRouter({
    //路由模式
    mode:'history',
    // 一级路由
    routes:[
        {
            //路由路径
            path:'/home',
            //路由组件
            component:Home,
            // 命名路由
            name:'Home'
        },
        {
            path:'/login',
            component:Login,
            name:'Login'
        },
        {
            path:'/register',
            component:Register,
            name:'Register'
        },
        {
            path:'/search',
            component:Search,
            name:'Search'
        },
        //重定向
        {
            path:'/',
            redirect:'/home',
        }
    ]
})
